//
//  videoTableViewCell.m
//  A Learning Walk
//
//  Created by dllo on 16/6/20.
//  Copyright © 2016年 战斗民族. All rights reserved.
//

#import "videoTableViewCell.h"

@interface videoTableViewCell ()

@property(nonatomic, retain)UIVisualEffectView *effect;

@end

@implementation videoTableViewCell
-(void)dealloc{
    
    [_model release];
    [_imageP release];
    [_imageV release];
    [_labelT release];
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatCell];
    }
    return self;
}
-(void)creatCell{
    self.imageV = [[UIImageView alloc] init];
    self.imageV.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.imageV];
    
    self.imageP = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"122"]];
    self.imageP.backgroundColor = [UIColor clearColor];
    [self.imageV addSubview:self.imageP];
    
    self.labelT = [FengLabel LabelwithFrame:CGRectMake(0, 0, 0, 0) Color:[UIColor clearColor] font:17];
    [self.imageV addSubview:self.labelT];
    
    UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
    self.effect = [[UIVisualEffectView alloc] initWithEffect:blur];
    self.effect.alpha = 1;
    [self.labelT addSubview:self.effect];
    
    
    [self.imageV release];
    [self.imageP release];
    [self.labelT release];
}
-(void)layoutSubviews{
    [super layoutSubviews];
    self.imageV.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height-15);
    self.imageP.frame = CGRectMake(self.imageV.frame.size.width/5*2, self.imageV.frame.size.height/4, self.imageV.frame.size.height/3, self.imageV.frame.size.height/3);
    self.labelT.frame = CGRectMake(0, self.imageV.frame.size.height-30, self.imageV.frame.size.width, 30);
    
    self.effect.frame = CGRectMake(0, 0, self.labelT.frame.size.width, self.labelT.frame.size.height);
}

-(void)setModel:(videoModel *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:_model.cover]];
    self.labelT.text = [NSString stringWithFormat:@"    %@",_model.title];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
